<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title am-cf">附近地点列表</div>
                </div>
                <div class="widget-body am-fr">
                    {if $list['errcode']==0}
                    <div class="tips am-margin-bottom-sm am-u-sm-12">
                        <div class="pre-info">
                            <p>最多可添加：{$list['data']['max_apply_num']}个地点</p>
                            <p>剩余可添加：{$list['data']['left_apply_num']}个地点</p>
                        </div>
                    </div>
                    {/if}
                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                        <div class="am-form-group">
                            <div class="am-btn-toolbar">
                                <div class="am-btn-group am-btn-group-sm">
                                    <a class="am-btn am-btn-primary am-radius"
                                       href="{:url('wxapp.nearby/add')}">
                                        <span class="am-icon-plus"></span> 添加
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="am-u-sm-12">
                        <table width="100%" class="am-table am-table-hover tpl-table-black">
                            <thead>
                            <tr>
                                <th>编号</th>
                                <th>地点ID</th>
                                <th>地理位置</th>
                                <th>资质证号</th>
                                <th>审核状态</th>
                                <th>驳回原因</th>
                                <th>附近展示</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {if $list['errcode']==0 AND isset($list['data']['data']['poi_list']) AND sizeof($list['data']['data']['poi_list'])>0}
                                <?php $n=10000;?>
                                {foreach $list['data']['data']['poi_list'] as $item}
                                <?php $n++;?>
                                <tr>
                                    <td class="am-text-middle">{$n}</td>
                                    <td class="am-text-middle">{$item['poi_id']}</td>
                                    <td class="am-text-middle">{$item['qualification_address']}</td>
                                    <td class="am-text-middle">{$item['qualification_num']}</td>
                                    <td class="am-text-middle">
                                        {$item['audit_status'] == 3 ? '审核中' : ''}
                                        {$item['audit_status'] == 4 ? '审核失败' : ''}
                                        {$item['audit_status'] == 5 ? '审核通过' : ''}
                                    </td>
                                    <td class="am-text-middle">
                                        {$item['audit_status'] == 4 ? $item['refuse_reason'] : '--'}
                                    </td>
                                    <td class="am-text-middle">
                                            <span class="j-state am-badge x-cur-p {$item['display_status']==1 ? ' am-badge-success' : ' am-badge-warning'}" 
                                                 data-id="{$item['poi_id']}"
                                                 data-status="{$item['display_status']}">
                                            {$item['display_status'] == 1 ? '展示中' : '未展示'}
                                            </span>
                                    </td>
                                    <td class="am-text-middle">
                                        <div class="tpl-table-black-operation">
                                            <a href="javascript:;" class="item-del tpl-table-black-operation-del"
                                               data-id="{$item['poi_id']}">
                                                <i class="am-icon-trash"></i> 删除
                                            </a>
                                        </div>
                                    </td>
                                </tr>
                                {/foreach}
                            {else /}
                                <tr>
                                    <td colspan="8" class="am-text-center">
                                        {$list['errcode'] == 0 ? '暂无记录' : 'code：'.$list['errcode'].'，msg：'.$list['errmsg']}
                                    </td>
                                </tr>
                            {/if}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        // 切换状态
        $('.j-state').click(function () {
            var data = $(this).data();
            var msg = '确定要'+(parseInt(data.status) === 1 ? '取消再该位置的展示' : '要在该位置展示')+'？';
            var url = "{:url('wxapp.nearby/status?status=')}";
            url = url + data.status;
            $('.j-state').del('id', url ,msg);
        });
        // 删除元素
        $('.item-del').del('id', "{:url('wxapp.nearby/delete')}");

    });
</script>

